/*
 * @Author: 秦福凯
 * @Date: 2024-07-24 08:47:15
 * @Description: 菜单配置
 * @FilePath: \研发云实验小学官网后台\sx-school-bg\sx-shcool-bg\src\store\sidebar.js
 */
import { defineStore } from 'pinia';
// import com_service from '@/api/componentsMan'

export const useSidebarStore = defineStore('sidebar', {
	state: () => {
		return {
			collapse: false,
			menuData:[
				{name:'首页',url:'/homeIndex',id:'0',icon:'HomeFilled'},
				// {name:'系统管理',id:'1',icon:'Place',childrenList:[
				// 	{name:'用户管理',url:'/user/userMan',id:'1-1',icon:'UserFilled'},
				// ]},
				// {name:'测试3',id:'3',icon:'Grid',childrenList:[
				// 	{name:'测试222',url:'/test/test2',id:'2-1',icon:'Grid'},
				// ]},
					{name:'组件展示',id:'C-F',icon:'Place',childrenList:[
						{name:'组件展示',url:'/com/commonpentDemo',id:'C-F-1',icon:'UserFilled'},
					]},


			],
			menuLoading:false
		};
	},
	getters: {},
	actions: {
		handleCollapse() {
			this.collapse = !this.collapse;
		},
		setBgColor(color) {
			this.bgColor = color;
			localStorage.setItem('sidebar-bg-color', color);
		},
		setTextColor(color) {
			this.textColor = color;
			localStorage.setItem('sidebar-text-color', color);
		},
		//获取菜单
		getMenusBySubSystem(param){
			return
			const Params = {
				timeStamp:'0',
				body:'',
				param:param,
			}
			this.menuLoading = true
			com_service.getMenusBySubSystemId(Params).then(res=>{
				this.menuLoading = false
				if(res.data.code == 200){
					this.menuData = res.data.data.menus
					localStorage.setItem('menuData',this.menuData)
				}else{
					ElMessage.warning(res.data.msg)
				}
			})}
	}
});
